Embodiments of the present invention relate to the field of virtual machines, and particularly, embodiments of the present invention relate to a method and device used by a virtual machine in communication with an external machine as well as a related virtual machine system.
A virtual machine is a complete computer system that is simulated through software, has complete hardware system functions, and runs in a complete isolated environment. Through virtual machine software, one or more virtual machines can be simulated on a single physical computer (hereinafter briefly referred to as a physical machine). These virtual machines work completely like real computers. For example, a user may install an operating system, install applications, access network resources, and talk by utilizing instant messaging software installed thereon, etc. From the perspective of the user, the virtual machine is only an application that runs on the physical machine; but for the applications running in the virtual machine, it is a real computer.
As mentioned above, the user may perform network communications with other physical machines or virtual machines on the network by utilizing an application running in the virtual machine (for example, a web browser, instant messaging software, etc.). It should be noted that when performing network communications in a common virtualized implementation (for example, an Xen-based virtualized system), only one particular virtual machine (for example, Dom0) among a plurality of virtual machines can directly interact with a network card in a bottom-layer hardware platform of the physical machine. Therefore, in order to perform network communications via the network card, a virtual machine must send, to the particular virtual machine, a data packet that is to be sent to an external machine (which may be a physical machine or a virtual machine) on the network. The data packet is then sent to the external machine from the particular virtual machine.